

#include "mymath.h"
//#include <openvdb/Exceptions.h>
//#include <openvdb/math/Stencils.h>
//#include <openvdb/openvdb.h>
//#include <openvdb/points/PointConversion.h>
//#include <openvdb/points/PointCount.h>
//#include <openvdb/tools/Interpolation.h>
//#include <openvdb/tools/MeshToVolume.h>
//#include <openvdb/tools/TopologyToLevelSet.h>
//#include <openvdb/tools/VolumeToMesh.h>
//#include <openvdb/util/Util.h>

#include <map>
#include <unordered_map>
//#pragma comment(lib, "openvdb.lib")
// #include "../../openvdb-11.0.0/openvdb/openvdb/tree/LeafManager.h"
// #include "../../openvdb-11.0.0/openvdb/openvdb/Grid.h"
//using namespace openvdb;
//
//using TreeType = FloatTree;
//using GridType = Grid<TreeType>;

GridAttributeStore::~GridAttributeStore() {}

void GridAttributeStore::SetField(std::string field, size_t gridid, double value)
{
  //MAPFIELD_ATT::iterator itFindField = mStore.find(field);
  //TreeType* tree                     = nullptr;
  //int x = -1, y = -1, z = -1;
  //IDTOXYZ(gridid, mVox, x, y, z);
  //if (itFindField == mStore.end())
  //{
  //  tree = new TreeType();
  //  tree->setValue(Coord(x, y, z), value);
  //  mStore[field] = (void*)tree;
  //}
  //else
  //{
  //  TreeType* pTree = (TreeType*)itFindField->second;
  //  pTree->setValue(Coord(x, y, z), value);
  //}
}

double GridAttributeStore::GetValue(std::string field, size_t gridid)
{
  int x, y, z;
  IDTOXYZ(gridid, mVox, x, y, z);
  return GetValue(field, x, y, z);
}

double GridAttributeStore::GetValue(std::string field, int x, int y, int z)
{
  //MAPFIELD_ATT::iterator itFindField = mStore.find(field);
  //TreeType* tree                     = nullptr;
  //double dRes                        = InvalidValue;
  //if (itFindField != mStore.end())
  //{
  //  TreeType* pTree = (TreeType*)itFindField->second;
  //  dRes            = pTree->getValue(Coord(x, y, z));
  //}
  //return dRes;
  return InvalidValue;
}

void GridAttributeStore::Reset()
{
  //MAPFIELD_ATT::iterator itStore;
  //MAPFIELD_ATT::iterator itStoreBegin = mStore.begin();
  //MAPFIELD_ATT::iterator itStoreEnd   = mStore.end();
  //for (itStore = itStoreBegin; itStore != itStoreEnd; ++itStore)
  //{
  //  TreeType* pTree = (TreeType*)itStore->second;
  //  delete pTree;
  //}
  //mStore.clear();
}
